VERSION 5.00
Begin VB.Form frmSettings 
   Caption         =   "Game settings"
   ClientHeight    =   1575
   ClientLeft      =   120
   ClientTop       =   450
   ClientWidth     =   4215
   LinkTopic       =   "Form1"
   ScaleHeight     =   1575
   ScaleWidth      =   4215
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdOK 
      Caption         =   "OK"
      Default         =   -1  'True
      Height          =   375
      Left            =   2160
      TabIndex        =   4
      Top             =   1080
      Width           =   975
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "Cancel"
      Height          =   375
      Left            =   3240
      TabIndex        =   5
      Top             =   1080
      Width           =   975
   End
   Begin VB.Frame fraLock 
      Height          =   855
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   4215
      Begin VB.TextBox txtHostPassword 
         Enabled         =   0   'False
         Height          =   285
         Left            =   1080
         TabIndex        =   3
         Top             =   360
         Width           =   3015
      End
      Begin VB.CheckBox chkHostPassword 
         Caption         =   "&Lock Game"
         Height          =   255
         Left            =   120
         TabIndex        =   2
         Top             =   0
         Width           =   1215
      End
      Begin VB.Label lblPassword 
         Caption         =   "&Password:"
         Height          =   255
         Left            =   120
         TabIndex        =   1
         Top             =   360
         Width           =   855
      End
   End
End
Attribute VB_Name = "frmSettings"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Copyright 2005, 2011 GTAMP.com gtamulti@gmail.com

'This program is free software: you can redistribute it and/or modify
'it under the terms of the GNU General Public License as published by
'the Free Software Foundation, either version 3 of the License, or
'(at your option) any later version.
'
'This program is distributed in the hope that it will be useful,
'but WITHOUT ANY WARRANTY; without even the implied warranty of
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'GNU General Public License for more details.
'
'You should have received a copy of the GNU General Public License
'along with this program.  If not, see <http://www.gnu.org/licenses/>

Option Explicit

Public Sub main()
On Error GoTo oops
    Me.Icon = frmGH.Icon
    Dim cR As New cRegistry
    frmSettings.Show vbModeless, frmGH
    If strPasswordProtectGame = "Yes" Then chkHostPassword.Value = vbChecked
    With cR
        .ClassKey = HKEY_CURRENT_USER
        .SectionKey = "software\GTA2 Game Hunter"
        .ValueKey = "HostPassword"
        txtHostPassword = .Value
    End With
   
Exit Sub

oops:
displaychat strChannel, vbRed, "Game settings fail"

End Sub

Private Sub chkHostPassword_Click()
    txtHostPassword.Enabled = chkHostPassword
    lblPassword.Enabled = chkHostPassword
End Sub

Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub cmdOK_Click()
    Dim cR As New cRegistry
'write host password, comment and other selection settings to registry
    With cR
        .ClassKey = HKEY_CURRENT_USER
        .SectionKey = "software\GTA2 Game Hunter"
        .ValueType = REG_SZ
        .ValueKey = "chkHostPassword"
        .Value = chkHostPassword
        .ValueKey = "HostPassword"
        .Value = txtHostPassword
        txtHostPassword.Enabled = chkHostPassword
    End With
    
    If txtHostPassword <> vbNullString And chkHostPassword = vbChecked Then
        strPasswordProtectGame = "Yes"
        strYourGamePassword = txtHostPassword
    Else
        chkHostPassword = vbUnchecked
        strYourGamePassword = vbNullString
        strPasswordProtectGame = "No"
    End If
Unload frmSettings
End Sub
